package com.lwj.liwanjia.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.bumptech.glide.Glide;
import com.lwj.liwanjia.R;
import com.lwj.liwanjia.bean.PinLunHomeBean;

import java.util.List;

import static com.lwj.liwanjia.R.id.url;

/**
 * Created by 001 on 2017/9/14.
 */

public class PinLunPhotoAdapter extends BaseAdapter {

    private Context mContext;
    private List<String> mList;

    public PinLunPhotoAdapter(Context mContext,List<String> mList) {
        this.mContext = mContext;
        this.mList = mList;

    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.adapter_pin_lun_photo, parent, false);
        }

        ImageView iv_photo = (ImageView) convertView.findViewById(R.id.iv_photo);

        String url = mList.get(position);

        Glide.with(mContext).load(url).into(iv_photo);

        return convertView;
    }
}
